#ifndef __C_CROSSFIRE_SINGLETON_H_
#define __C_CROSSFIRE_SINGLETON_H_

template <class T>
class CSingleton
{
public:
  static T * singletonPtr() { return s_pSingleton; }
  static T & singleton()    { /*mAssert(s_pSingleton);*/ return *s_pSingleton; }
  static void assertConstruct(T* pThis)
  {
    s_pSingleton = pThis;
  }
  ~CSingleton()
  {
    s_pSingleton = 0;
  }
protected:
  /*CF_CORE_API*/ static T * s_pSingleton;
};

#define IMPLEMENT_SINGLETON(className) className * className::s_pSingleton = 0;

#endif